const _static = require('koa-static');
module.exports = function(router, options) {
	options = options || {};
	options.html = options.html || 10;
	options.script = options.script || 20;
	options.styles = options.styles || 30;
	options.img = options.img || 40;
	options.other = options.other || 50;

	router.all(/((\.jpg)|(\.png)|(\.gif))$/i, _static('./static', {
		maxage: 1000 * 60 * 60 * 24 * options.img
	}))
	router.all(/((\.js)|(\.jsx))$/i, _static('./static', {
		maxage: 1000 * 60 * 60 * 24 * options.script
	}))
	router.all(/((\.html)|(\.htm))$/i, _static('./static', {
		maxage: 1000 * 60 * 60 * 24 * options.html
	}))
	router.all(/((\.css))$/i, _static('./static', {
		maxage: 1000 * 60 * 60 * 24 * options.styles
	}))
	router.all('*', _static('./static', {
		maxage: 1000 * 60 * 60 * 24 * options.other
	}))
}
